﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using LibService.DTO;

namespace LibService.DAO
{
    public class QuanHuyenDAO
    {
        #region 1. Lay Danh Sach Thong Tin Quan Huyen
        public static List<QuanHuyenDTO> layDanhSachQuanHuyen()
        {
            List<QuanHuyenDTO> lst = new List<QuanHuyenDTO>();
            try
            {
                SQLConnect cnn = new SQLConnect();
                DataTable dt = new DataTable();
                dt = cnn.ExecuteQuery("sp_layThongTinQuanHuyen", CommandType.StoredProcedure);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    QuanHuyenDTO qh = new QuanHuyenDTO();
                    qh.MaQuanHuyen = dt.Rows[i]["MaQuanHuyen"].ToString();
                    qh.TenQuanHuyen = dt.Rows[i]["TenQuanHuyen"].ToString();
                    lst.Add(qh);
                }
            }
            catch (Exception ex)
            {

            }
            return lst;
        }
        #endregion
    }
}